﻿
@{
    ViewBag.Title = "ShoppingCarList";
    Layout = "~/Views/Shared/_LayoutPageAll.cshtml";
}
<script src="~/js/jquery-1.8.2.js"></script>
<script>

    $(function () {
        var id=@Session["UserID"] ;

        $.ajax({
            url: "http://localhost:19451/api/Order/GetShowOrder",
            type: "Get",
            // data: "{'pagesize':'" + q + "','pagindex':'"+w+"'}",
            data:{id:id},
            success: function (data) {
                var tr = ""
                var sum = 0;
                $(data).each(function (i, item) {
                    tr += " <tr class='odd'><td class='qty'>" + item.OrderNum + "x</td><td class='products'><a href='/product/convallis-sit-amet-tellus'>" + item.OrderName + "</a></td><td class='price'><span class='uc-price'>￥" + item.Orderprice + "</span></td><td class='price'><span class='uc-price'>￥" + item.OrderSum + "</span></td><td>" + item.OrderAddr + "</td><td>" + item.OrderPhone + "</td><td><a href='#' onclick='del(" + item.OrderId + ")'>删除</a></td></tr>"
                    sum += item.Orderprice * item.OrderNum;
                });
                //显示
                tr += "<tr class='subtotal even'><td colspan='3' class='subtotal'><span id='subtotal-title'> 总计 :</span> <span class='uc-price'>￥" + sum + "</span></td> </tr>";

                var str = "";
                str += " <tr><td class='title'>合计:</td><td class='price'><span class='uc-price'>￥" + sum + "</span></td></tr>";
                str += "<tr><td class='title'>购物车总计:</td><td class='price'><span class='uc-price'>￥" + sum + "</span></td></tr>";

                $("#t1").append(tr);
                $("#sum").append("<span class='value'><span class='uc-price'></span>￥：" + sum + "</span>")
                $("#uc-order-total-preview").append(str)
            }
        })
    })

    function del(obj) {
        var id = obj;
        $.ajax({
            url: "http://localhost:19451/api/Order/GetDelOrder",
            type: "Get",
            data: {id:id },
            success: function (i) {
                if (i > 0) {
                    alert("成功删除！")
                    location.href="/Order/ShoppingCarList"
                }
                else {
                    alert("删除失败！")
                }
            }
        })
    }

    function cancels(){
        $("#edit-panes-comments-comments").val("");
    }
    function sub() {
        var id=@Session["UserID"] ;
        var advice = $("#edit-panes-comments-comments").val()
        var email = $("#edit-panes-customer-primary-email").val();
        if (advice == ""&&email=="") {
            if(confirm("您确定不提出建议吗？"))
            {
                alert('提交成功')
            }
        }
        else {


            $.ajax({
                url: "http://localhost:19451/api/Order/GetAddOrder",
                type: "Get",
                //data: "{'advice':'" + advice + "','email':'" + email + "'}",
                data: { advice: advice, email: email ,userid: id},
                success: function (n) {
                    if (n > 0) {
                        alert("我们已收到您的建议");
                    } else {
                        alert("建议失败");
                    }
                }
            })
        }
        $.ajax({
            url:"/Order/send",
            type:"post",
            data:{ mailTo: email},
            success:function(n)
            {
                if(n=="True")
                {
                    alert("已收到您的建议，请及时查看您的邮箱！")
                }
                else
                {
                    alert("邮箱格式不正确")
                }
            }
        })

    }
    function pay() {
        $("#payment-pane").css("display", "block");
    }
</script>

<div class="content clearfix">

    <div class="breadcrumbs">
        <h2 class="element-invisible">You are here</h2><div class="breadcrumb"><a href="/Home/index">返回主页</a> » 付款</div>
    </div>
    @*订单信息填写*@
    <div id="content" class="column left-content">
        <div class="section">
            <div class="region region-content">
                <div id="block-system-main" class="block block-system">
                    <div class="content">
                        <form class="uc-cart-checkout-form" action="/cart/checkout" method="post" id="uc-cart-checkout-form" accept-charset="UTF-8">
                            <div>
                                @*购物车信息显示*@
                                <fieldset class="form-wrapper" id="cart-pane">
                                    <legend><span class="fieldset-legend">订单信息</span></legend><div class="fieldset-wrapper">
                                        <table class="cart-review sticky-enabled">
                                            <thead><tr><th class="qty"><abbr title="Quantity">数量</abbr></th><th class="products">商品名</th><th class="price">单价 </th><th class="price">总价 </th><th class="price">送货地址</th><th class="price">联系电话</th><th class="price">编辑订单</th></tr></thead>
                                            <tbody id="t1"></tbody>
                                        </table>
                                    </div>
                                    <span><a onclick="DelAll()" href="#">清空订单</a></span>
                                    <div id="dd"></div>
                                </fieldset>

                                @*反馈块*@

                                @*收货信息块*@
                                <fieldset class="form-wrapper" id="delivery-pane">
                                    <div id="block-uc-cart-cart" class="block block-uc-cart">
                                        <h2><span class="cart-block-title-bar">Cart</span></h2>
                                        <div class="content">
                                            <table class="cart-block-items"><tbody><tr class="odd"><td class="cart-block-item-qty">订单</td><td class="cart-block-item-title"><a href="/product/convallis-sit-amet-tellus">convallis sit amet tellus</a></td><td class="cart-block-item-price"><span class="uc-price">￥：金额</span></td></tr></tbody></table><div class="cart-box">
                                                <div class="body">
                                                    <ul id="ul">
                                                        <li class="info">
                                                            <span class="products"><strong><span class="num-items">结账</span>： </strong></span>
                                                        </li>
                                                        <li class="price" id="sum">
                                                            <span class="label">小计</span>

                                                        </li>
                                                    </ul>
                                                    <a class="submit-button" onclick="pay()">
                                                        付款

                                                    </a>
                                                    <div class="graphic"></div>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                </fieldset>

                                <fieldset class="form-wrapper" id="payment-pane" hidden="hidden">
                                    <div id="block-uc-cart-cart" class="block block-uc-cart">

                                        <div class="content">
                                            <table class="cart-block-items"><tbody><tr class="odd"><td class="cart-block-item-qty">请选择付款方式</td><td class="cart-block-item-title"><a href="/product/convallis-sit-amet-tellus">convallis sit amet tellus</a></td><td class="cart-block-item-price"></td></tr></tbody></table><div class="cart-box">
                                                <div class="body">

                                                    <ul id="ul">
                                                        <li class="price">
                                                            <span class="label"><strong><span class="uc-price"><a href="#">微信支付</a></span> </strong></span>
                                                        </li>
                                                        <li class="price">
                                                            <span class="label"><strong><span class="uc-price"><a href="#">支付宝支付</a></span> </strong></span>
                                                        </li>
                                                        <li class="price">
                                                            <span class="label"><strong><span class="uc-price"><a href="#">其他付款方式</a></span> </strong></span>
                                                        </li>

                                                    </ul>
                                                    <div id="line-items-div">
                                                        <table id="uc-order-total-preview"></table>
                                                    </div>

                                                    <div class="form-item form-type-radios form-item-panes-payment-payment-method form-disabled">

                                                        <div id="edit-panes-payment-payment-method" class="form-radios">
                                                            <div class="form-item form-type-radio form-item-panes-payment-payment-method form-disabled">
                                                                <input disabled="disabled" type="radio" id="edit-panes-payment-payment-method-paypal-wps" name="panes[payment][payment_method]" value="paypal-wps" checked="checked" class="form-radio" />  <label class="option" for="edit-panes-payment-payment-method-paypal-wps"><img src="https://www.paypal.com/en_US/i/logo/PayPal_mark_37x23.gif" alt="PayPal" class="uc-credit-cctype" /> 贝宝,支付没有分享你的财务信息<br /><span id="paypal-includes">包括: <img class="uc-credit-cctype uc-credit-cctype-visa" typeof="Image" src="http://cooker.envato.tabvn.com/sites/all/modules/ubercart/payment/uc_credit/images/visa.gif" alt="Visa" /> <img class="uc-credit-cctype uc-credit-cctype-mastercard" typeof="Image" src="http://cooker.envato.tabvn.com/sites/all/modules/ubercart/payment/uc_credit/images/mastercard.gif" alt="MasterCard" /> <img class="uc-credit-cctype uc-credit-cctype-discover" typeof="Image" src="http://cooker.envato.tabvn.com/sites/all/modules/ubercart/payment/uc_credit/images/discover.gif" alt="Discover" /> <img class="uc-credit-cctype uc-credit-cctype-amex" typeof="Image" src="http://cooker.envato.tabvn.com/sites/all/modules/ubercart/payment/uc_credit/images/amex.gif" alt="American Express" /> <img class="uc-credit-cctype uc-credit-cctype-echeck" typeof="Image" src="http://cooker.envato.tabvn.com/sites/all/modules/ubercart/payment/uc_credit/images/echeck.gif" alt="eCheck" /> <img src="https://www.paypal.com/en_US/i/logo/PayPal_mark_37x23.gif" alt="PayPal" class="uc-credit-cctype" /></span> </label>
                                                            </div>
                                                        </div>
                                                    </div>
                                                    <a class="submit-button" onclick="pay()">
                                                        确认付款

                                                    </a>
                                                    <div class="graphic"></div>
                                                </div>
                                            </div>
                                        </div>
                                    </div>

                                </fieldset>
                                @*商品备注*@
                                <fieldset class="form-wrapper" id="comments-pane">
                                    <legend><span class="fieldset-legend">添加订单备注信息 </span></legend>
                                    <div class="fieldset-wrapper">
                                        <div class="fieldset-description">使用这个区域提出我们存在的问题或关于你的建议</div>
                                        <div class="form-item form-type-textarea form-item-panes-comments-comments">
                                            <div class="form-textarea-wrapper resizable"><textarea id="edit-panes-comments-comments" name="mailContent" cols="60" rows="5" class="form-textarea"></textarea></div>
                                        </div>
                                    </div>
                                </fieldset>
                                <fieldset class="form-wrapper" id="customer-pane">
                                    <legend><span class="fieldset-legend">反馈信息</span></legend><div class="fieldset-wrapper">
                                        <div class="fieldset-description">输入一个有效的电子邮件地址我们将把反馈信息发送至您的邮箱</div>
                                        <div class="form-item form-type-textfield form-item-panes-customer-primary-email">
                                            <label for="edit-panes-customer-primary-email">E-mail 地址 <span class="form-required" title="This field is required.">*</span></label>
                                            <input type="email" id="edit-panes-customer-primary-email" name="mailTo" value="" size="32" maxlength="64" class="form-text required" />
                                        </div>
                                    </div>
                                </fieldset>
                                <div class="form-actions form-wrapper" id="edit-actions">
                                    <input type="button" value="取消" onclick="cancels()" class="form-submit" />
                                    <input type="button" onclick="sub()" value="提交订单" class="form-submit" />
                                </div>
                                @*反馈块*@
                                <fieldset class="form-wrapper" id="customer-pane">
                                    <legend><span class="fieldset-legend">卖家承诺</span></legend>


                                    <div class="form-item form-type-textfield form-item-panes-customer-primary-email">

                                        <label for="edit-panes-customer-primary-email"><a>诚信为本</a> <span class="form-required" title="This field is required.">*</span></label>
                                        <div class="form-item form-type-textarea form-item-panes-comments-comments">
                                            <div class="form-textarea resizable" style="text-align:left;width:550px">

                                                <p>1）卖家承诺在销售过程中不出现缺斤少两的情况;</p>
                                                <p>2）卖家承诺本店食材绝对新鲜，优质，假一罚十;</p>
                                                <p>3）卖家承诺不销售国家明令淘汰或者过期、失效、变质的商品;</p>

                                            </div>
                                        </div>
                                    </div>
                                </fieldset>
                            </div>
                        </form>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <div>
        @*右边模块*@
        <div id="sidebar-second" class="column sidebar right-content">
            <div class="section">
                <div class="region region-sidebar-second">
                    @*电话热线*@
                    <div class="content">
                        <div class="call-us">
                            <span class="label">请拨打！！！</span><span class="pop phone">0800/ 567 345</span><span class="label">工作时间：</span><span class="pop">0-24h</span>
                        </div>
                    </div>
                    <div id="block-custom-sidebar-featured-meals" class="block block-custom">

                        <img style="width: 100%; height: auto; max-width: 100%; display: block;" src="~/image/1.jpg" />

                    </div>
                    <div class="call-us">
                        <p><span class="pop">感谢您的购买</span></p>
                        <p><span class="pop">我们将推出更</span></p>
                        <p><span class="pop">多的新菜品！</span></p>
                    </div>
                </div>

            </div>
        </div>
    </div>
</div>

